<template>
  <h1>我是Count组件的标题</h1>
  <p>Foo事件:{{ msg }}</p>
  <p>数字增加:{{ num }}</p>
  <button @click="saveFooValue">传输数据给父组件</button>
  <button @click="num++">add</button>
  <button @click="msg += '@'">修改名字</button>
  <button @click="savePrice">传递价格到Hello组件</button>
</template>

<script setup>
import MyBus from "../MyBus";
import { ref } from "vue";
let msg = ref("hashMap");

let num = ref(0);

// 接收传过来的事件
const emits = defineEmits(["FooCount"]);
// 定义事件传递父组件数据
function saveFooValue() {
  emits("FooCount", "我是子组件传来的参数");
}

// 产地价格
function savePrice() {
  MyBus.emit("savePrice", 999);
}
</script>

<style>
</style>